package com.film.admincontroller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.Film;
import com.film.service.FilmService;
import com.film.service.impl.FilmServiceImpl;

/**
 * 用来做热门电影下架的分页
 * @author 2119196781
 *
 */
@WebServlet("/offTheShelifhotFilmPage.do")
public class HotOffTheShelifhotFilmPageController extends HttpServlet{
	private FilmService filmService = new FilmServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String pageNum = request.getParameter("page");
		String isDelete = request.getParameter("isDelete");
		List<Film> offTheShelfFilms =  filmService.selectFilmLimitHot(Integer.parseInt(pageNum),Integer.parseInt(isDelete));
		List<Film> offTheShelfFilm = filmService.selectOffTheShelfHotFilm();
		session.setAttribute("offTheShelfFilm", offTheShelfFilm);
		session.setAttribute("offTheShelfFilms", offTheShelfFilms);
		response.sendRedirect("admin_jsp/hotOffTheShelfFilm.jsp?flag="+pageNum);
	}
}
